$m(function(args){
	var $this = this.element;
	var data = args.data;
	var node = args.source;
	var parameters = data.parameters;
	// 当前模块名称
	var currentModelName;
	// 当前模块名称
	var currentModelParam;
	
	var getMetaData = function() {
		return node.miningnode("getMetaData");
	}
	//对于btn组件中禁止默认打开编辑的表格id集合 熵值法 相似度 典型相关分析 相关系数 偏相关分析
	var btnBanDefaultEdit = ["entropyevaluation_cols","similaritiesmeasure_self_var","canonicalcorr_variable","canonicalcorr_totalObserved",
								"correlationcoefficient_variable","corrvar","variableselection_feature"];

	if(args.currentModelName == "subtotal"){
		$("#graph_util_rightzone_columnselect").css("width","520px")
	}
	/**
	 * 初始化对话框
	 */
	var initDialog = function () {
		var maindg = args.dialog;
		/**
		 * 配置框默认高度: window.constant.MINE_DIALOG_SIZE.BIG.height
		 * 配置框默认宽度:	window.constant.MINE_DIALOG_SIZE.BIG.width
		 * 	如不是，则设置参数param的height和width属性
		 * 确认按钮和取消按钮的文本不需要添加，已经处理
		 */
		var dialogWidth = window.constant.MINE_DIALOG_SIZE.MAX.width;
		//修改分类汇总配置框宽度
		if(args.currentModelName == "subtotal"){
			dialogWidth = 850;
		}
		var param = {
			width:dialogWidth,
			height:window.constant.MINE_DIALOG_SIZE.MAX.height,
			confirm: {
				id:'tempo-mine-util-savebtn',
				click:function() {
					//返回true，表示设置完成，需要关闭对话框，否则不关闭
					return savePagePropertyValue();
				}
			},
			cancel: {
				click:function() {
					//函数默认为空，需要时自己在js里添加，不要在组件里添加
					return cancelPagePropertyValue();
					//不做任何处理, 一般可以不需要取消函数
				}
			},
			values: parameters
		}
		if(args.addHeight != null){
			param.height += args.addHeight;
		}
		if(args.currentModelName == "subtotal"){
			param.width = param.width +70;
		}
		//初始化配置框
		maindg.init(param);
	}
	var callGridFunction = function(functionName, divClassName) {
        //判断是不是变量选择节点
        if (currentModelName == "variableselection"){//是
            //获取右侧表格数据
            return divClassName.tempo_grid_columns_selected_with_btn(functionName);
        }else if(currentModelName == "entropyevaluation"){// 判断是不是熵值法
        	return divClassName.tempo_grid_columns_selected_with_btn(functionName);
        }else {//其他节点
            return divClassName.grid_columns_selected_with_btn(functionName);
        }

	}

	/**
	 * 点击确定，页面保存方法 ---公共的
	 */
	var savePagePropertyValue = function(){
		debugger
		if (!validForm()){
			return false;
		}
		// 保存当前选择的列信息
		var curMedata = getMetaData();
		if (!args.rightParams.notSavePreMeta){
			parameters.preMetadata = curMedata;
		}
		parameters.metadata = curMedata;
		// 保存右侧表格id
		var ids = [];
		parameters.gridData = {};
		var rightZone = args.rightParams.rightZone;
		for (var i=0;i<rightZone.length;i++){
			// 若右侧区域为自定义界面，则直接跳过
			if (rightZone[i].type && rightZone[i].type == "udfElement"){
				continue;
			}
			var id = rightZone[i].id;
			var grid = args.zoneCache[id];
			if(btnBanDefaultEdit.indexOf(id) > -1){
				var dataObj = {};
				//判断节点是否是带有分页效果的节点
				if(currentModelName == "variableselection" || currentModelName == "entropyevaluation"){
					//保存表格里正在修改的行数据
                    callGridFunction("saveCurrentEditRow", grid);
					//获取选中框里的值
					dataObj.rowDatas = callGridFunction("getAllData",grid);
				}else{
					//获取选中框里的值
					dataObj.rowDatas = callGridFunction("getAllEditOrDataFunction",grid);
				}
				var udfModelList = rightZone[i].udfColsModel;
				var editVlist = [];//meta最后添加的编辑的值
				$.each(udfModelList,function(i,v){
					if(v.edittype != null){
						editVlist.push(v.name);
					}
				});
				var saveMetaList = [];
				$.each(dataObj.rowDatas,function(i,v){
					var node = [v.desc,v.name,v.type,v.role];
					for(var j = 0 ; j < editVlist.length ; j++){
						node.push(v[editVlist[j]]);
					}
					saveMetaList.push(node);
				});
				dataObj.savedMeta = saveMetaList;
                parameters[id] = dataObj.savedMeta;
                // 前台展示的表格数据
                parameters.gridData[id] = dataObj.rowDatas;
			}
			else{
				// 为了去除分类汇总的分页
				var dataObj;
				if (id == "subtotal_countCol") {
					//先保存编辑行
					var gridT = callGridFunction("getGridTable",grid);
					var lastId = gridT.datagrid("getLastEditId");
					gridT.datagrid("saveRow",lastId);
					dataObj = callGridFunction("getRowData",grid);
					// 后台需要解析的表格数据
					parameters[id] = dataObj;
					// 前台展示的表格数据
					parameters.gridData[id] = dataObj;
				}else {
					dataObj = callGridFunction("getEditRowData",grid);
					// 后台需要解析的表格数据
					parameters[id] = dataObj.savedMeta;
					// 前台展示的表格数据
					parameters.gridData[id] = dataObj.rowDatas;
				}
			}
			ids.push(id);
		}
		parameters.joinCol=$this.find('#subtotal_joinCol_join').is(':checked');
		if(parameters.joinCol == false){
			parameters.gridData["subtotal_joinCol"]=[];
			parameters["subtotal_joinCol"]=[]
		}
		parameters.gridIds = ids;
		// 调用当前模块的保存方法，保存其他属性
		Eventbus.triggerHandler(addPre("savePagePropertyValue"))[0];
		return true;
	}

	/**
	 * 点击取消，页面取消方法 ---公共的
	 */
	var cancelPagePropertyValue = function () {
        //判断右侧的值是否存在。第一次进入时是不存在的
        if (parameters && parameters.gridIds && parameters.gridIds.length){
            //将右侧两个框的数据进行还原
            var len = parameters.gridIds.length;
            for (var i=0; i<len; i++) {
                var oldSelectDataId = "oldSelectData_" + parameters.gridIds[i];
                parameters[parameters.gridIds[i]] = parameters[oldSelectDataId];
            }
        }
		// 调用当前模块的取消方法，取消保存的属性
		Eventbus.triggerHandler(addPre("cancelPagePropertyValue"))[0];
	}

	/**
	 * 点击确定，页面校验方法
	 */
	var validForm = function(){
		// 循环校验右侧列选择区域是否允许为空，若不允许，则校验
		var rightZone = args.rightParams.rightZone;
		var paramss={}
		//获取是否拼接
		var joinFlag = $this.find('#subtotal_joinCol_join').is(':checked');
		for (var i=0;i<rightZone.length;i++){
			var id = rightZone[i].id;
			//没有选择拼接，则不去校验
			if (id == "subtotal_joinCol" && !joinFlag){
				continue;
			}
			var grid = args.zoneCache[id];
			var rowDatas;
			// 如果是分类汇总使用不分页的方法
			if (id.indexOf("subtotal") != -1) {
				rowDatas = grid.grid_columns_selected_with_btn("getAllEditOrDataFunction");
			}else {
				rowDatas = grid.tempo_grid_columns_selected_with_btn("getAllEditOrDataFunction");
			}
			var udfModelList = rightZone[i].udfColsModel;
			var editVlist = [];//meta最后添加的编辑的值
			$.each(udfModelList,function(i,v){
				if(v.edittype != null){
					editVlist.push(v.name);
				}
			});
			var saveMetaList = [];
			$.each(rowDatas,function(i,v){
				var node = [v.desc,v.name,v.type,v.role];
				for(var j = 0 ; j < editVlist.length ; j++){
					node.push(v[editVlist[j]]);
				}
				saveMetaList.push(node);
			});
			paramss[id] = saveMetaList;
			// 若右侧区域为自定义界面，则直接跳过
			if (rightZone[i].type && rightZone[i].type == "udfElement"){
				continue;
			}
			var currentZone = args.zoneCache[rightZone[i].id];
			var datas= {};
			//判断带有分页的节点 变量选择第一个框是分页框  熵值法第二框是分页框
			if (id == "variableselection_feature" || id == "entropyevaluation_cols"){
				// 先保存
				callGridFunction("saveCurrentEditRow",currentZone);
				// 在获取分页组件的全部数据
				datas.rowDatas = callGridFunction("getAllData",currentZone);
			}else {
				datas.rowDatas = callGridFunction("getRowData",currentZone);
			}

			// 校验当前列是否被修改或删除
			var fieldErrorMap = callGridFunction("getFieldErrorMap",currentZone);
			for (var j=0;j<datas.rowDatas.length;j++){
				var errorMap = fieldErrorMap.get(datas.rowDatas[j].desc);
				// 错误信息为空，或类型不匹配，则跳过
				if (!errorMap || errorMap.meta.type != datas.rowDatas[j].type){
					continue;
				}
				var errorInfo = TempoMineMetaUtils.getTypeChangedTip();
				if (errorMap.reason == "name"){
					errorInfo = TempoMineMetaUtils.getFieldNotExistsTip();
				}
				$("<div/>").alert({
					msg:datas.rowDatas[j].desc+":"+errorInfo,
					title:TempoUtils.locale("mine.prompt")
				});
				return false;
			}
			if (rightZone[i].allowNull){
				continue;
			}
			if (rightZone[i].isNotValidNull && rightZone[i].isNotValidNull == true) {

			} else {
				if (!currentZone || datas.rowDatas.length == 0){
					$("<div/>").alert({
						msg:TempoUtils.locale("mine.selectColumnNotNull"),
						title:TempoUtils.locale("mine.prompt")
					});
					return false;
				}
			}
		}

		//开启拼接，需要校验拼接字段是否全包含分组字段
		if(joinFlag){
			if(paramss.subtotal_splitCol.length ==0){
				$("<div/>").alert({
					msg:TempoUtils.locale("subtotal.nogroupcolumn"),
					title:TempoUtils.locale("mine.prompt")
				});
				return false;
			}
			if(paramss.subtotal_joinCol.length ==0){
				$("<div/>").alert({
					msg:TempoUtils.locale("subtotal.nojoincolumn"),
					title:TempoUtils.locale("mine.prompt")
				});
				return false;
			}
		}
		// 调用当前模块的校验方法
		var flag = Eventbus.triggerHandler(addPre("validForm"),args.zoneCache)[0];
		return flag;
	}
	
	/**
	 * 初始化列操作区域，并赋值
	 */
	var initColumnSelectZone = function(){
		// 若自定义了高度，则修改顶部区域的高度
		if (currentModelParam && currentModelParam.rightZoneHeight){
			$("#graph_util_topzone").height(currentModelParam.rightZoneHeight);
			$this.find("#graph_util_rightzone_columnselect").height(currentModelParam.rightZoneHeight);
		}
		// 设置左右居于同一行，在js中设置会出现弹出框大小被改变的问题
		var leftColumnSelect = $this.find("#graph_util_leftzone_columnselect");
		leftColumnSelect.css({"float":"left"});
		$this.find("#graph_util_rightzone_columnselect").css({"float":"left"});
		// 初始化左侧待选区域
		initLeftZone(leftColumnSelect);
		// 初始化右侧已选区域
		initRightZone(leftColumnSelect);
		//分类汇总中新增中间的下拉框
		if(args.currentModelName  == "subtotal"){
			$this.find("#graph_util_rightzone_columnselect").width(590);
			initSelect();//初始化下拉框
		}
		if(args.currentModelName  == "entropyevaluation"){
			initSelect2();
		}
	}
	var initSelect2 = function(){
		var $position = $this.find('#entropyevaluation_cols');
		var str = "<span>";
		str += "<label style='margin-left:90px'>"+TempoUtils.locale("entropyevaluation.batch")+"</label>";
		str += "&nbsp;&nbsp;&nbsp;&nbsp;";
		str += "<select id='entropyevaluationSelect'>";
		str += "<option value='1'>"+TempoUtils.locale("entropyevaluation.maxAttsCols")+"</option>";
		str += "<option value='0'>"+TempoUtils.locale("entropyevaluation.minAttsCols")+"</option>";
		str += "</select>";
		str += "</span>";
		$(str).insertBefore($position);
		$this.find('#entropyevaluation_cols').css('margin-top','2px');
		$this.find("#entropyevaluationSelect").selectmenu({
			width:90,
			select : function(e,ui){
				var grid = args.zoneCache['entropyevaluation_cols'];
				//获取批量下拉框的值
				var bestdirectionVal = ui.item.value;
				//获取jqGrid的GridTable对象
				var gridTable = callGridFunction("getGridTable", grid);
				//批量设置当前页选中的数据中的某一字段的值
				grid.tempo_grid_columns_selected_with_btn("batchSyncData", gridTable, "bestdirection", bestdirectionVal);
			}
		});
		if(parameters.subSelectVal != null){
			$this.find("#entropyevaluationSelect").selectmenu("setValue",parameters.entropyevaluationSelect);
		}
	}
	/**
	 * 初始化下拉框
	 */
	var initSelect = function(){
		debugger
		var $position = $this.find('#subtotal_countCol');
		var $rightDiv = $this.find('#graph_util_rightzone_columnselect');
		var $joinCol = $this.find('#subtotal_joinCol');
		var join = "<input type='checkbox' id='subtotal_joinCol_join' ui-role='checkbox' class='tempo-checkbox'/>" +
			"<label for='subtotal_joinCol_join' style='margin-left: 90px'>"+TempoUtils.locale("subtotal.joinCol")+"</label><span class='customFormat-helpIcon' " +
			"title='是否将原表数据与汇总结果进行拼接，分组字段作为连接字段'></span><select id='subtotalSelect' style='visibility: hidden;' class='tempo-selectmenu'></select>";
		$(join).insertBefore($joinCol);
		$this.find('#subtotal_joinCol_join').unbind('click').bind('click',function(){
			if($(this).is(':checked')){
				$joinCol.css('visibility','inherit');
			}else{
				$joinCol.css('visibility','hidden');
			}
		});
		if(parameters.joinCol){
			$this.find('#subtotal_joinCol_join').trigger('click');
		}else{
			$joinCol.css('visibility','hidden');
		}
		var str = "<span>";
		str += "<label style='margin-left:90px'>"+TempoUtils.locale("subtotal.batchnum")+"</label>";
		str += "&nbsp;&nbsp;&nbsp;&nbsp;";
		str += "<select id='subtotalSelect'>";
		str += "<option value='count_val'>"+TempoUtils.locale("subtotal.count_val")+"</option>";
		str += "<option value='max_val'>"+TempoUtils.locale("subtotal.max_val")+"</option>";
		str += "<option value='min_val'>"+TempoUtils.locale("subtotal.min_val")+"</option>";
		str += "<option value='avg_val'>"+TempoUtils.locale("subtotal.avg_val")+"</option>";
		str += "<option value='sum_val'>"+TempoUtils.locale("subtotal.sum_val")+"</option>";
		str += "<option value='var_samp_val'>"+TempoUtils.locale("subtotal.var_samp_val")+"</option>";
		str += "<option value='stddev_samp_val'>"+TempoUtils.locale("subtotal.stddev_samp_val")+"</option>";
		str += "<option value='countDistinct_val'>"+TempoUtils.locale("subtotal.countDistinct_val")+"</option>";
		str += "<option value='upQuartile'>"+TempoUtils.locale("subtotal.upQuartile")+"</option>";	
		str += "<option value='downQuartile'>"+TempoUtils.locale("subtotal.downQuartile")+"</option>";	
		str += "<option value='median'>"+TempoUtils.locale("subtotal.median")+"</option>";
		str += "<option value='cv_val'>"+TempoUtils.locale("subtotal.cv_val")+"</option>";
		str += "<option value='udfQuantile'>"+TempoUtils.locale("subtotal.percentile")+"</option>";
		str += "</select>";

		str += "<label id='subtotalValueLabel' style='margin-left:10px'>"+TempoUtils.locale("subtotal.value")+"</label>";
		str += "&nbsp;&nbsp;&nbsp;&nbsp;";
		str += "<input type='text' id='subtotalValue' name='subtotalValue' ui-role='validatebox' style='padding-bottom: 2px;'/>";
		
		str += "<label id='subtotalStrSelecLabel' style='margin-left:103px'>"+TempoUtils.locale("subtotal.batchStr")+"</label>";
		str += "&nbsp;&nbsp;&nbsp;&nbsp;";
		str += "<select id='subtotalStrSelec'>";
		str += "<option value='count_val'>"+TempoUtils.locale("subtotal.count_val")+"</option>";
		str += "<option value='countDistinct_val'>"+TempoUtils.locale("subtotal.countDistinct_val")+"</option>";	
		str += "</select>";
		
		str += "</span>";
		$(str).insertBefore($position);
		//增加近似计算和精准计算
		var str1 = "<div class='tempo-mine-dp-subtotal-right-bottom-radios' style='float: right;margin-left: 0px;margin-top: -135px;'>";
		//近似计算
		str1 += "<input type='radio' id='approximate-subtotal' class='tempo-radio' name='subtotal-way-set' checked='checked'/>";
		str1 += "<label for='approximate-subtotal'>近似计算</label>";
		//精准计算
		str1 += "<input type='radio' id='precision-subtotal' class='tempo-radio' name='subtotal-way-set'/>";
		str1 += "<label for='precision-subtotal' style='margin-left: 20px'>精准计算</label>";
		str1 += "<span id='disInfoSubtotal' class='ui-icon tempo-ui-icon tempo-ui-icon-tip tempo-mine-button' style='margin-left: 10px;'></span>";
		str1 += "</div>";
		$(str1).insertAfter($rightDiv);
		//增加提示框
		var helpInfo="<div id='helpInfoSubtotal' style='background: rgb(243, 245, 247);" +
			"position:absolute;position:absolute;width:200px;height:35px;backgroud:#e0e5e5;" +
			"box-shadow:0px 0px 10px rgb(46, 49, 53);z-index:99999;text-align: center;'>"+TempoUtils.locale("subtotal.helpInfo")+"</div>";
		//判断只初始化一次
		if($("#helpInfoSubtotal").length == 0){
			$('body').append(helpInfo);
		}
		var x=$("#disInfoSubtotal").offset().left;
		var y=$("#disInfoSubtotal").offset().top;
		$("#helpInfoSubtotal").css("left",x+20);
		$("#helpInfoSubtotal").css("top",y+20);
		$("#helpInfoSubtotal").hide();
		$("#disInfoSubtotal").mouseover(function(){
			$("#helpInfoSubtotal").show();
		})
		$("#disInfoSubtotal").mouseout(function(){
			$("#helpInfoSubtotal").hide();
		})

		$this.find('#subtotal_countCol').css('margin-top','2px');
		$this.find("#subtotalValue").validatebox({
			width: '40px'
		});
		//只有当选择为百分位数时才展示
		$this.find("#subtotalValueLabel").hide();
		$this.find("#subtotalValue").hide();
		$this.find("#subtotalValue").off("focusout").on("focusout",function(){
			var value = $this.find("#subtotalValue").val();
			var rule = /^[1-9][0-9]?$/;
			var nustr = TempoUtils.locale("mine.meta_fields_label_number");
			if(value == ""){
				return false;
			} else {
				if(!rule.test(value)){
					showTip(TempoUtils.locale("subtotal.valueError"));
					return false;
				}
			}
			var grid = args.zoneCache['subtotal_countCol'];
			var checkrows = grid.find('input[type="checkbox"]:checked');//所有被选择的元素
			if(checkrows && checkrows.length <= 0){
				return false;
			}
			//先把所有被选中的行保存,如果不保存，text和attr会把组件一起渲染掉
			var gridTable = callGridFunction("getGridTable",grid);
			var length = callGridFunction("getAllEditOrDataFunction",grid).length;
			for(var i = 1;i<=length;i++){
				gridTable.datagrid('saveRow',i);
			}
			var allmodify = checkrows.closest('tr').find('td[aria-describedby$="type"][title^='+nustr+']').next().next();
			allmodify.text(value);
			allmodify.attr('title',value);
			var allGridData = callGridFunction("getAllEditOrDataFunction",grid);
			for(var i = 0;i < allGridData.length; i++){
				var calcFunc = allGridData[i].calcFunc;
				if(calcFunc != "udfQuantile"){
					var tdInput = gridTable.find("tr[id="+(i+1)+"]").find('td[aria-describedby$="value"]');
					tdInput.text("");
					tdInput.attr('title',"");
				}
			}
		});

		$this.find("#subtotalStrSelec").selectmenu({
			width:90,
			select : function(e,ui){
				var grid = args.zoneCache['subtotal_countCol'];
				//获取批量下拉框的值
				var calcFuncVal = ui.item.value;
				//获取jqGrid的GridTable对象
				var gridTable = callGridFunction("getGridTable", grid);
				//批量设置当前页选中的数据中的某一字段的值
				grid.tempo_grid_columns_selected_with_btn("batchSyncData", gridTable, "calcFunc", calcFuncVal, "String");
			}
		});

		$this.find("#subtotalSelect").selectmenu({
			width:90,
			select : function(e,ui){
				var grid = args.zoneCache['subtotal_countCol'];
				var nustr = TempoUtils.locale("mine.meta_fields_label_number");
				if(ui.item.value == "udfQuantile"){
					$this.find("#subtotalValueLabel").show();
					$this.find("#subtotalValue").show();
					$this.find("#subtotalStrSelecLabel").css('margin-left','22px');
				} else {
					$this.find("#subtotalValueLabel").hide();
					$this.find("#subtotalValue").hide();
					$this.find("#subtotalStrSelecLabel").css('margin-left','103px');
				}
				var checkrows = grid.find('input[type="checkbox"]:checked');//所有被选择的元素
				if(checkrows && checkrows.length <= 0){
					showTip(TempoUtils.locale("subtotal.selectnull"));
					return false;
				}
				//获取批量下拉框的值
				var calcFuncVal = ui.item.value;
				//获取jqGrid的GridTable对象
				var gridTable = callGridFunction("getGridTable", grid);
				//批量设置当前页选中的数据中的某一字段的值
				grid.tempo_grid_columns_selected_with_btn("batchSyncData", gridTable, "calcFunc", calcFuncVal, "Double");

				var jisuanWay = $('input[name=subtotal-way-set]:checked').attr('id');
				//中位数或者百分位数显示近似计数和精准计数
				if(ui.item.value == "udfQuantile" || ui.item.value == "median" || ui.item.value == "upQuartile" || ui.item.value=="downQuartile"){
					$(".tempo-mine-dp-subtotal-right-bottom-radios").show();
					$('#'+jisuanWay).radio({
						checked : true,
					});
				} else {
					var newGridDate = callGridFunction("getAllEditOrDataFunction",grid);
					for(var i = 0;i < newGridDate.length;i++){
						var newCalcFunc = newGridDate[i].calcFunc;
						if(newCalcFunc == "udfQuantile" || newCalcFunc == "median" || ui.item.value == "upQuartile" || ui.item.value=="downQuartile"){
							$(".tempo-mine-dp-subtotal-right-bottom-radios").show();
							$('#'+jisuanWay).radio({
								checked : true,
							});
							break;
						}
						$(".tempo-mine-dp-subtotal-right-bottom-radios").hide();
						$('#approximate-subtotal').radio({
							checked : true,
						});
					}
				}
			}
		});
		
		if(parameters.subSelectVal != null){
			$this.find("#subtotalSelect").selectmenu("setValue",parameters.subSelectVal);
		}
		if(parameters.subSelectStrVal != null){
			$this.find("#subtotalStrSelec").selectmenu("setValue",parameters.subSelectStrVal);
		}
		if(parameters.subSelectVal != null && parameters.subSelectVal == "udfQuantile"){
			$this.find("#subtotalValueLabel").show();
			$this.find("#subtotalValue").show();
			$this.find("#subtotalStrSelecLabel").css('margin-left','22px');
		}
	}
	var showTip = function(_msg) {
		$("<div/>").alert({
			msg : _msg,
			title : TempoUtils.locale("setrole.prompt")
		});
	}
	/**
	 * 左侧待选列区域初始化
	 */
	var initLeftZone = function(leftColumnSelect){
		var metadata = getMetaData();
		// 得到所有已选的字段名的数组
		var chooseDatas = TempoMineMetaUtils.getChoosedDatas(parameters.gridData);
		// 加载待选列
		var liDataSet = [];
		if (metadata && metadata.length > 0){
			for (var i=0;i<metadata.length;i++) {
				var obj = TempoMineMetaUtils.convertMetaToObj(metadata[i]);
				// 将已选到右侧列过滤掉
				if (args.rightParams.leftTreeChangeable == false) {
					
				} else {
					if (chooseDatas.names.indexOf(obj.name) > -1 && chooseDatas.types[chooseDatas.names.indexOf(obj.name)] == obj.type && chooseDatas.descs.indexOf(obj.desc) > -1){
						continue;
					}
				}

				liDataSet.push(obj);
			}
		}
		var showRadios = [];
		if (currentModelParam.showRadios){
			showRadios = currentModelParam.showRadios;
		}
		// 初始化左侧框
		if(currentModelName =="variableselection" || currentModelName == "subtotal" || currentModelName == "entropyevaluation"){
			leftColumnSelect.mine_columnselect({
				data:liDataSet,
				width:"275px",
				height:"100%",
				hideToolBar:true,
				showRadios:showRadios,
				pagesize:20,
				pagination:true,
			});
			leftColumnSelect.find(".tempo-mine-column-list").css("overflow","auto");
			leftColumnSelect.find("#columnPage").css("position","absolute").css("width","235px");
		}else{
			leftColumnSelect.columnselect({
				data:liDataSet,
				width:"275px",
				height:"100%",
				hideToolBar:true,
				showRadios:showRadios,
				pagesize:20,
				pagination:true,
			});
		}
	}
	
	/**
	 * 得到所有已选的字段名与类型的数组
	 */
	var getChoosedDatas = function(){
		debugger;
		if (!parameters.gridData){
			return {"names":[],"types":[]};
		}
		var names = [];
		var types = [];
		for (var key in parameters.gridData){
			var rowData = parameters.gridData[key];
			for (var i=0;i<rowData.length;i++){
				names.push(rowData[i].desc);
				types.push(rowData[i].type)
			}
		}
		return {"names":names,"types":types};
	}
	
	/**
	 * 右侧已选区域初始化 --公共的
	 */
	var initRightZone = function(leftColumnSelect){
		// 若rightZone列表为空，则直接返回
		if (!currentModelParam || !currentModelParam.rightZone || currentModelParam.rightZone.length == 0){
			return; 
		}
		var rightGrids = currentModelParam.rightZone;
		var totalHeight = $("#graph_util_topzone").height();
		// totalHeight-23为左侧待选区域的高度，27为列表表头的高度，35为fieldset的边框
		var avgHeight = (totalHeight-7)/rightGrids.length;
		if (currentModelParam.rightZone.fieldset && currentModelParam.rightZone.fieldset.show){
			avgHeight = avgHeight - 35;
		}
		// 当前元信息
		var metadata = getMetaData();
		for (var i=0;i<rightGrids.length;i++){
			addGridZoneToPanel(metadata,rightGrids[i],avgHeight,$this.find("#graph_util_rightzone_columnselect_table"),leftColumnSelect);
		}
	}
	
	/**
	 * 根据传入的参数，生成grid_columns_selected_with_btn组件，并添加至父容器上 --公共的
	 */
	var addGridZoneToPanel = function (metadata,zoneParam,height,parantEle,leftColumnSelect){
		var rowDatas = [];
		if (parameters.gridData && parameters.gridData[zoneParam.id]){
			rowDatas = $.extend(true,[],parameters.gridData[zoneParam.id]);
		}
		if (!zoneParam.udfContextColLabels){
			zoneParam.udfContextColLabels = {};
		}
		var td = $("<td/>");
		var tr = $("<tr/>");
		td.appendTo(tr);
		tr.appendTo(parantEle);
		var thisZone = $("<div id='"+zoneParam.id+"'/>").appendTo(td);
		var udfColsModel = [];
		// 自定义coleModel
		if (zoneParam.udfColsModel){
			udfColsModel = zoneParam.udfColsModel;
		}
		// 自定义colLabel
		var udfColLabels = [];
		if (zoneParam.udfColLabels){
			udfColLabels = zoneParam.udfColLabels;
		}
		// 自定义接收类型
		var allowTypes = [];
		if (zoneParam.allowTypes){
			allowTypes = zoneParam.allowTypes;
		}
		// 自定义列表可接收的最大数据量
		var gridMaxData = 1;
		if (zoneParam.gridMaxData){
			gridMaxData = zoneParam.gridMaxData;
		}
		// 自定义隐藏类型
		var contextHiddenColNames = ["desc","type"];
		if (zoneParam.contextHiddenColNames){
			contextHiddenColNames = zoneParam.contextHiddenColNames;
		}
		var defaultWidth = ["20px","75px","75px","77px"];
		if (zoneParam.defaultWidth) {
			defaultWidth = zoneParam.defaultWidth;
		}
		var uniquefield = false;
		if (zoneParam.uniquefield) {
			uniquefield = zoneParam.uniquefield;
		}
		var directToEdit = {inEditDirect:false};
		if (zoneParam.directToEdit && Object.keys(zoneParam.directToEdit).length > 0) {
			directToEdit = zoneParam.directToEdit;
		}
		var removeDup = false;
		if (zoneParam.removeDup) {
			removeDup = zoneParam.removeDup;
		}
		var multEdit = false;
		if (zoneParam.multEdit) {
			multEdit = zoneParam.multEdit;
		}
		//自定义width
		var width = 405;//之前的版本就是405 这里保持不变
		if (zoneParam.width) {
			width = zoneParam.width;
		}
		debugger;
		// 若type不是udfElement（自定义界面），则初始化为表格
		if (!zoneParam.type || zoneParam.type != "udfElement"){
			// 自定义高度
			if (zoneParam.height){
				height = zoneParam.height;
			}
			height = height-40;
			//初始化表格
			//判断是否是带有分页效果的节点
			if(currentModelName == "variableselection" || currentModelName == "entropyevaluation"){
				//保存原始数据，可能有多个，使用每个框id保存
				var oldSelectDataId = "oldSelectData_" + zoneParam.id;
				parameters[oldSelectDataId] = rowDatas;
				//是带有分页效果的节点
				thisZone.tempo_grid_columns_selected_with_btn({
					"width" : width,
					"height" : ("variableselection_label" ==zoneParam.id || "entropyevaluation_goal" ==zoneParam.id)?height:height-40,
					"pendingDiv":leftColumnSelect,
					"contextMeta":metadata, //上下文字段信息列表
					"udfContextColLabels":zoneParam.udfContextColLabels,
					"contextHiddenColNames":contextHiddenColNames,//将字段名和类型隐藏
					"rowsData":rowDatas,
					"udfColLabels":udfColLabels,
					"udfColsModel" : udfColsModel,
					"parentDialog":$this,
					"fieldset":zoneParam.fieldset,
					"allowTypes":allowTypes,
					"gridMaxData":gridMaxData,
					"uniquefield":uniquefield,//针对同一个字段进行处理
					"removeDup":removeDup,
					isRendercboxClass:true,
					directToEdit:directToEdit,
					multEdit:multEdit,
					pagination:("variableselection_label" ==zoneParam.id || "entropyevaluation_goal" ==zoneParam.id)?false:true,
					showBtn:TempoMineUtils.canEdit(args.data.formEditable),
					editable:TempoMineUtils.canEdit(args.data.formEditable),
					defaultWidth:defaultWidth,
					leftTreeChangeable:args.rightParams.leftTreeChangeable,
				});
				thisZone.find("td[align=center]").css("width","235px");
			}else{
				thisZone.grid_columns_selected_with_btn({
					"width" : width,
					"height" : height,
					"pendingDiv":leftColumnSelect,
					"contextMeta":metadata, //上下文字段信息列表
					"udfContextColLabels":zoneParam.udfContextColLabels,
					"contextHiddenColNames":contextHiddenColNames,//将字段名和类型隐藏
					"rowsData":rowDatas,
					"udfColLabels":udfColLabels,
					"udfColsModel" : udfColsModel,
					"parentDialog":$this,
					"fieldset":zoneParam.fieldset,
					"allowTypes":allowTypes,
					"gridMaxData":gridMaxData,
					"uniquefield":uniquefield,//针对同一个字段进行处理
					"removeDup":removeDup,
					isRendercboxClass:true,
					directToEdit:directToEdit,
					multEdit:multEdit,
					pagination:"variableselection_label" !=zoneParam.id?true:false,
					showBtn:TempoMineUtils.canEdit(args.data.formEditable),
					editable:TempoMineUtils.canEdit(args.data.formEditable),
					defaultWidth:defaultWidth,
					leftTreeChangeable:args.rightParams.leftTreeChangeable,
				});
			}
			// 设置按钮居中显示,getOption("height")为列表内容高度，需加27(表头高度)，再减去22(按钮)，最后再除2
			thisZone.find(".tempo-mine-grid-columns-with-selbtn-btn").css({"margin-top":(height+5)/2.0,"margin-left":"15px"});
			debugger;
			//监听右侧grid变化事件
			var id=thisZone.find("table").eq(1).attr("id");
			var targetGridCompete = $("#"+id).jqGrid('getGridParam').gridComplete;

			$("#"+id).jqGrid('getGridParam').gridComplete=function(){
				debugger;
				//删除之后判断是否需要展示分类汇总的近似计算和精准计算
				if(args.currentModelName == "subtotal"){
					var grid = args.zoneCache['subtotal_countCol'];
					var newGridDate = grid.tempo_grid_columns_selected_with_btn("getAllEditOrDataFunction");
					if(newGridDate && newGridDate.length > 0){
						var jisuanWay = $('input[name=subtotal-way-set]:checked').attr('id');
						for(var i = 0;i < newGridDate.length;i++){
							var newCalcFunc = newGridDate[i].calcFunc;
							if(newCalcFunc == "udfQuantile" || newCalcFunc == "median" ||
								newCalcFunc == "upQuartile" || newCalcFunc == "downQuartile"){
								$(".tempo-mine-dp-subtotal-right-bottom-radios").show();
								$('#'+jisuanWay).radio({
									checked : true,
								});
								break;
							}
							$(".tempo-mine-dp-subtotal-right-bottom-radios").hide();
							$('#approximate-subtotal').radio({
								checked : true,
							});
						}
					} else {
						$(".tempo-mine-dp-subtotal-right-bottom-radios").hide();
						$('#approximate-subtotal').radio({
							checked : true,
						});
					}
				}
				Eventbus.triggerHandler(addPre("bindEvent"),args.zoneCache)[0];

				if (targetGridCompete){
					targetGridCompete.call($("#"+id));
				}
			}

		} else {
			if (zoneParam.height){
				height = zoneParam.height;
			}
			// 设置div的高度
			$this.find("#"+zoneParam.id).height(height);
		}
		// 缓存当前对象grid_columns_selected_with_btn,若需要
		args.zoneCache[zoneParam.id] = thisZone;
		if(args.currentModelName == "subtotal"){
			callGridFunction("getGridTable",thisZone).datagrid({
				oneRowEdit : function(rowid) {
					var calcFuncValue = $(this).children().find("tr[id='"+rowid+"']").find("select[id='"+rowid+"_calcFunc']").val();
					var input = $(this).children().find("tr[id='"+rowid+"']").find("input[id='"+rowid+"_value']");
					if(calcFuncValue == "udfQuantile"){
						input.validatebox({readonly : false});
						input.removeAttr("unselectable");
					} else {
						input.validatebox({readonly : true});
						input.attr("unselectable", "on");
					}
				}
			})
		}
	}
	
	/**
	 * 添加当前模块的前缀
	 */
	var addPre = function(labelKey){
		if (currentModelName == ""){
			return labelKey;
		}
		return currentModelName + "." + labelKey;
	}
	
	/**
	 * 完成配置界面的初始化功能
	 */
	var initProperty = function() {
		debugger;
		// 页面初始化
		initDialog();
		// 初始化右侧缓存对象
		args.zoneCache = {};
		// 当前模块名称赋值
		currentModelName = args.currentModelName;
		currentModelParam = args.rightParams;
		// 初始化列操作区域，并赋值
		initColumnSelectZone();
		// 调用当前图标模块的初始化及赋值方法
		Eventbus.triggerHandler(addPre("initAndFillback"))[0];
		TempoMineUtils.disabledPropertyParam($this, args.data.formEditable);
	}
	
	/**
	 * 调用初始化功能
	 */
	initProperty();
});